/*********************************************************************************
  *Copyright (c)    2021   xldeng
  *FileName:        singleton.h
  *Author:          xldeng
  *Version:         1.0
  *Date:            2021/2/25 21:29
  *Description:
  *Others:
  *Function List:
     1.…………
  *History:
     1.Date:
       Author:
       Modification:
**********************************************************************************/

#ifndef SYLAR_SINGLETON_H
#define SYLAR_SINGLETON_H
#include <memory>
namespace sylar {
    template<class T, class X = void, int N = 0>
    class Singleton {
    public:
        static T* GetInstance(){
            static T v;
            return &v;
        }
    };

    template<class T, class X = void, int N = 0>
    class SingletonPtr {
    public:
        static std::shared_ptr<T> * GetInstance(){
            static std::shared_ptr<T> v(new T);
            return v;
        }
    };
}
#endif //SYLAR_SINGLETON_H
